package com.itheima.functinalInterface;

import java.util.function.Supplier;

public class MySupplierDemo1 {
    
    public static void main(String[] args) {
        
        int[] arr = {100, 20, 50, 30, 99, 101, -50};
        int result = min(arr, () -> {
            int min = arr[0];
            for (int i : arr) {
                if (i < min) {
                    min = i;
                }
            }
            return min;
        });
        System.out.println(result);
        // arr = {1, 2, 3};
    }
    
    private static int min(int[] arr, Supplier<Integer> supplier) {
        Integer integer = supplier.get();
        return integer;
    }
}
